package cn.ven.service;

import cn.ven.config.PassConfig;
import cn.ven.dao.UserDao;
import cn.ven.entity.MyUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserDao userDao;



    @Override
    public void addUser(MyUser user) {
        user.setRole("B");
//        user.setPassword("$2a$10$dD4rojUbwahpzMhaQRd9/u1YmcP4LWNLdSH8T32Pmfv8I.dr9AyEO");//因为不会加密，所有直接写死，123456
        userDao.addUser(user);
    }

    @Override
    public MyUser findByUsername(String username) {
        return userDao.findByUsername(username);
    }

    @Override
    public MyUser findById(String id) {
        return userDao.findById(id);
    }

    @Override
    public List<MyUser> findAll() {
        return userDao.findAll();
    }


}
